package com.bcbim.model_server_interface.component.vo;

import com.bcbim.model_server_interface.component.bo.ComponentMaterialBO;
import lombok.Data;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.List;

/**
 * @Description:
 * @Author: ye
 * @Date: 2022/2/15
 * @Version: V1.0
 **/
@Data
public class ComponentMaterialVO implements Serializable {
    /**
     * 构件id
     */
    private String componentId;
    /**
     * 构件的revitId
     */
    private String revitId;
    /**
     * 文件id
     */
    private String fileId;
    /**
     * 构件类别
     */
    private String category;
    /**
     * 中心点坐标
     */
    private XYZ center;
    private List<MaterialIndexVO> list;

    public ComponentMaterialVO() { }

    public ComponentMaterialVO(ComponentMaterialBO component) {
        if (component == null) {
            return;
        }
        if (StringUtils.isNotEmpty(component.getComponentId())) {
            this.componentId = component.getComponentId();
        }
        if (StringUtils.isNotEmpty(component.getCategory())) {
            this.category = component.getCategory();
        }
        if (StringUtils.isNotEmpty(component.getRevitId())) {
            this.revitId = component.getRevitId();
        }
        if (StringUtils.isNotEmpty(component.getFileId())) {
            this.fileId = component.getFileId();
        }
        if (ObjectUtils.isNotEmpty(component.getX())
                || ObjectUtils.isNotEmpty(component.getY())
                || ObjectUtils.isNotEmpty(component.getZ())) {
            center = new XYZ(component.getX(),component.getY(),component.getZ());
        }
    }
}
